import { Controller, Get, Req, UseGuards } from '@nestjs/common';
import { AuthGuard } from 'src/common/auth/auth.guard';
import { UserService } from '../services/user.service';
import { ResponseUtils } from 'src/common/utils/response.utils';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';

@Controller('api/user')
@UseGuards(AuthGuard)
@ApiBearerAuth()
@ApiTags('微信-用户')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Get('info')
  @UseGuards(AuthGuard)
  @ApiOperation({ summary: '用户信息' })
  async getUser(@Req() req: any) {
    const userId = req.userId;
    const userInfo = await this.userService.getUserInfoByUserId(userId);
    return ResponseUtils.success({ userInfo });
  }
}
